// pages/album/index/index.js
import{albumModel} from '../model.js';

Page({

	/**
	 * 页面的初始数据
	 */
	data: {
        start:0,
        cid:0,
        list:[],
        category:[],
        limit:15
	},

	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad: function (options) {
        let cid=this.data.cid;
        if(options.cid){
          cid=options.cid;
        }
        
        this.getList(cid,this.data.start);
    
        albumModel.getAd('honor',(res)=>{
          this.setData(Object.assign(this.data,res))
        });
    },
    
    getList(cid,start){
        albumModel.getList({cid,start},(res) => {
          let list=this.data.list.concat(res.data.list);
          this.setData({
            list:list,
            cid:res.data.cid,
            start:list.length,
            category:res.data.category
          });
        });
      },
    
      onLower(e){
        this.getList(this.data.cid,this.data.start);
      },


	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage: function () {

	}
})